<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="../js/mui.min.js"></script>
    <link href="../css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="../css/style.css" />
    <link rel="stylesheet" href="../css/swiper.css" />
    <link rel="stylesheet" href="../css/iconfont.css" />   
    <style>
    	.scroll {height:30px;width:60%;max-width:640px;overflow:hidden;color: #000000;display:inline-block;position: relative;position: absolute;left: 120px;top:6px;}
		.scroll ul {width:100%;position:absolute;left:0;top:0;}
		.scroll li {height:30px;line-height:30px;}
        .scroll li a{display: block;color: #666666;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;font-size: 14px;}
        .swiper-wrapper img{height: 150px!important;}	
    </style>
    <script type="text/javascript" src="../js/swiper.min.js" ></script>
    <script type="text/javascript" src="../js/jquery-1.8.0.min.js" ></script>
    <script type="text/javascript" src="../js/common.js" ></script>
    <script type="text/javascript" src="../js/session.js" ></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=wqBXfIN3HkpM1AHKWujjCdsi"></script>
    <script type="text/javascript" charset="utf-8">
      	mui.init();
    </script>
</head>
<body>
	<div class="mui-content">
		<!--首页-->
		<div id="container"></div>
	    <div id="tabbar" class="mui-control-content mui-active">
	    	<header class="mui-bar mui-bar-nav header">
			    <div class="ditu-icon"><img src="../images/ditu-icon.png"></div>
			    <div class="address-text" style="overflow: hidden;"></div>
			    <div class=" mui-search search-input">
					<input id="search" type="search"  class=" mui-input-clear mui-icon-search" placeholder="搜索">
				</div>
			</header> 	
			<div class="banner" style="margin-top: 44px;">
				<div class="swiper-wrapper" id="banner">
	                 <!--<div class='swiper-slide'><img src='../images/banner.png'></div>
	                 <div class='swiper-slide'><img src='../images/banner.png'></div>
	                 <div class='swiper-slide'><img src='../images/banner.png'></div>-->
				</div>
				<div class="swiper-pagination"></div>
			</div>
			<div class="tongzhi">
				<a data-href="gongaolist.html"><img src="../images/gonggao-back.png" width="120"/></a>
				
				<div id="scroll" class="scroll clearfix">
	                <ul id="zxyw">
	                    <!--<li><a data-href="">余额不足，请及时缴费！</a></li>
	                    <li><a data-href="">余额不足，请及时缴费！</a></li>
	                    <li><a data-href="">余额不足，请及时缴费！</a></li>
	                    <li><a data-href="">余额不足，请及时缴费！</a></li>-->
	                </ul>
	            </div>
			</div>
			<ul class="shouye-btn-list">
				<li>
					<a id="dtgl"><img src="../images/shouye-btn1.png"><span>电梯管理</span></a>
				</li>
				<li>
					<a data-href="../qianbao/jiaofei.html"><img src="../images/shouye-btn2.png"><span>在线缴费</span></a>
				</li>
				<li>
					<a data-href="../qianbao/index.html"><img src="../images/shouye-btn3.png"><span>我的钱包</span></a>
				</li>
				<li>
					<a data-href="../yanglao/index.html"><img src="../images/shouye-btn4.png"><span>居家养老</span></a>
				</li>
				<li>
					<a data-href="../shopping/index.html?type=1"><img src="../images/shouye-btn5.png"><span>在线购物</span></a>
				</li>
				<li>
					<a data-href="hehuoren.html"><img src="../images/shouye-btn6.png"><span>成为合伙人</span></a>
				</li>
				<li>
					<a data-href="../jiazheng/index.html"><img src="../images/jiazheng-icon.png"><span>家政服务</span></a>
				</li>
	
				<li>
					<a data-href="../shopping/index.html?type=3"><img src="../images/peijian-icon.png"><span>配件商城</span></a>
				</li>
				<li>
					<a data-href="huzhulist.html"><img src="../images/diti-icon.png"><span>社区互助</span></a>
				</li>
			</ul>
			<div class="redian">
				<h1 class="xinwen-title">热点新闻<a data-href="rendian-list.html" style="display: block;float: right;color: #ff9632;">更多>></a></h1>
			    <ul class="redian-list" id="redian-list">
			    	<!--<li>
			    		<a data-href="">
			    			<div>
			    				<h1 class="only-twoline">向着网络强国阔步前行— — 党的十八大以来网信事业发 展述评</h1>
			    				<p>
			    					2019-11-11
			    				</p>
			    			</div>
			    			<div>
			    				<img  src="../images/banner.png"/>
			    			</div>
			    		</a>
			    	</li>-->
			    </ul>
			</div>	
		</div>	
	</div>
	<footer>
		<nav class="mui-bar mui-bar-tab footer">
			<a class="mui-tab-item mui-active "data-href="index.html">
				<span class="mui-icon iconfont icon-shouye-active"></span>
				<span class="mui-tab-label">首页</span>
			</a>
			<a class="mui-tab-item" href="javascreapt(0)">
				<span class="mui-icon "></span>
				<span class="mui-tab-label"></span>
			</a>
			
			<a class="mui-tab-item" id="wode" data-href="myself.html">
				<span class="mui-icon iconfont icon-Personal" ></span>
				<span class="mui-tab-label">我的</span>
			</a>
		</nav>	
	</footer>	
	    <!-- <script>
	    	//加载footer
			mui("footer").load("/public/index-footer1.html")
	    </script> -->
		<script>
		 
			$("#search").focus(function(){
				location.href="search.html";
			})
			mui("footer").on("tap","a[data-href]",function(){
				location.href=$(this).attr("data-href");
//				mui.openWindow({url:$(this).attr("data-href")})
			})
			
			mui(".shouye-btn-list").on("tap","a[data-href]",function(){
				location.href=$(this).attr("data-href");
			})
			mui("#zxyw").on("tap","a",function(){
				mui.openWindow({url:$(this).attr("data-href")})
			})
			mui("#redian-list").on("tap","a",function(){
				mui.openWindow({url:$(this).attr("data-href")})
			})
			mui(".xinwen-title").on("tap","a",function(){
				mui.openWindow({url:$(this).attr("data-href")})
			})
			mui(".tongzhi").on("tap","a",function(){
				mui.openWindow({url:$(this).attr("data-href")})
			})
//			点击电梯管理判断是否登陆
			mui(".shouye-btn-list").on("tap","#dtgl",function(){
				var userid=getCookie("userid");
				var work=getCookie("work");	
				if(userid==null||userid==""){
					alert("您还没有登录，请登录")
					location.href="login.html"
					
				}else{
					
					if(work=="1"){
//						location.href="../guanli/guanliindex.html"
						mui.openWindow({url:"../guanli/guanliindex.html"})
					}else if(work=="2"){
//						location.href="../guanli/index.html"
						mui.openWindow({url:"../guanli/index.html"})
					}else{
						mui.openWindow({url:"xiangqing.html"})
						
					} 
				}
			})
			
		</script>			
		<script>
//			百度定位
			var map = new BMap.Map("container");
			var point = new BMap.Point(116.331398,39.897445);
			map.centerAndZoom(point,12);
			var geolocation = new BMap.Geolocation();
			geolocation.getCurrentPosition(function(r){
				if(this.getStatus() == BMAP_STATUS_SUCCESS){
                    var gc = new BMap.Geocoder();
                    gc.getLocation(r.point, function (rs) {
                        var addComp = rs.addressComponents;
                        var province = addComp.province;
                        var city = addComp.city;
                        var area = addComp.district;
               	    	var town = getCookie("town")
               	    	var townid="";
               	    	if(town!=null&&town!=""){
               	    		$(".address-text").html(town);
               	    	}else{
  //                       保存区
                            var param={};
                            param.town=area;
                            $.post(net+"public/index.php?s=api/index/getarea/town",param,function(res){
                            	if(res.code=="201"){
                            		townid=res.result.area_id;
                            		addCookie("town",area,7);
	             	    	        addCookie("townid",townid,7);
                            	}
                            })
	                        $(".address-text").html(area);
               	    	}
                        mui("header").on("tap",".address-text",function(){
                        	mui.openWindow({url:"city.html"})
                        })
                        if (province != "" && city != "" && area != "") {
                            $("#demo1").val(province + " " + city + " " + area);
                        }
                    })
				}
				else {
					alert('failed'+this.getStatus());
				}        
			});
		</script>
		<script>
			mui.plusReady(function(){
				//版本更新
				var version=""
				//获取当前版本号
				plus.runtime.getProperty(plus.runtime.appid,function(inf){
				    version = inf.version;
				});
				$.post(net+"/public/index.php/api/Renew",{},function(res){
					console.log(JSON.stringify(res))
					if(res.code=="200"){
						if(res.result.upEdition!=version){
							let openUrl = plus.os.name === 'iOS' ? res.result.upIosUrl : res.result.upAndroidUrl;
							if(confirm("发现新版本"+res.result.upEdition+"，需要更新吗?")){
								plus.runtime.openURL(openUrl);
							}
						}
					}
				})
			})
			$(function(){
		    
				//读取banner
			
			$.post(net+"public/index.php?s=api/index/index_banner",{data:null},function(data){
	                if(data.code==200){
		               	if(data.result!=null&&data.result!=""&&data.result.length!=0){
		               		var str="";
		               		$.each(data.result, function() {
		               	   	    str+="<div class='swiper-slide'><img src='"+net+"public/uploads/home/adv/"+this.adv_code+"'></div>"
		               	    });
		               	    $("#banner").empty();
		               	    $("#banner").append(str)
		               	    var mySwiper1 = new Swiper('.banner',{
								pagination: '.swiper-pagination',
								paginationClickable: true,
								slidesPerView: 1,
							    speed:500,
							    autoplay: 3000,
							    loop:true
							});
		               	}
	               	  
	                }
				   },'json'
				);
					//读取公告
			    $.post(net+"/public/index.php?s=api/index/index_notice",{data:null},function(data){
	               if(data.code==200){
		               	if(data.result!=null&&data.result!=""&&data.result.length!=0){
		               		var str="";
		               		$.each(data.result, function(i,value) {
		               	   	    str+="<li><a data-href='newsinfo.html?id="+this.article_id+"'>"+this.article_title+"</a></li>"
		               	   });
		               	   $("#zxyw").append(str)
		               	    var scrollIndex=0;
						    var Timer=null;
						    scroll_f()
						    function scroll_f(){
						        clearInterval(Timer);
						        var ul=$("#scroll ul");
						        var li=ul.children("li");
						        var h=li.height();
						        var index=0;
						        ul.css("height",h*li.length*2);
						        ul.html(ul.html()+ul.html());
						        function run()
						        {
						            if(scrollIndex>=li.length){
						                ul.css({top:0});
						                scrollIndex=1;
						                ul.animate({top:-scrollIndex*h},200);
						            }
						            else{
						                scrollIndex++;
						                ul.animate({top:-scrollIndex*h},200);
						            }
						        }
						        Timer=setInterval(run,1500);
						    }
		               	}
	               }
				   },'json'
				);
			//热点新闻
			$.post(net+"/public/index.php?s=api/index/index_hotnews",{data:null},function(data){
	               if(data.code==200){
		               	if(data.result!=null&&data.result!=""&&data.result.length!=0){
		               		var str="";
		               		$.each(data.result, function(i,value) {
		               			var time=timestampToDate(this.article_time);
		               	   	    str+='<li><a data-href="rendian-info.html?id='+this.article_id+'"><div><h1 class="only-twoline">'+this.article_title+'</h1><p class="redian-list-orange"> '+time+'<span class="liulan">浏览量：'+this.click_num+'<span></p></div><div><img  src="'+net+"public/uploads/home/article/"+this.article_pic+'"/></div></a></li>'
		               		});
		               	   $("#redian-list").append(str)
		               	   // 文字滚动出现	        
		   
			               	}
		            }
			},'json'
			);
	})

		</script>
</body>
</html>